﻿using System.Data;
using MySqlConnector;

namespace Management.EntityFrameworkCore.MySql;

public class GetConnectString
{
    private static string? _connectionString { get; set; }

    private static readonly IDbConnection _dbConnection = new MySqlConnection();

    public static string? ConnectionString
    {
        get => _connectionString;
        set => _connectionString = value;
    }

    public static IDbConnection DbConnection
    {
        get
        {
            if (string.IsNullOrEmpty(_dbConnection.ConnectionString))
            {
                _dbConnection.ConnectionString = ConnectionString;
            }

            return _dbConnection;
        }
    }
}